package com.kede.app.domain;

import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @description /
* @author Pr.li
* @date 2023-06-06
**/
@Entity
@Data
@Table(name="t_supplies_store")
@EntityListeners(AuditingEntityListener.class)
public class SuppliesStore implements Serializable {
    /**
    * 
    */
    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    private Integer id;
    /**
    * 门店id
    */
    @ApiModelProperty(value = "门店id")
    @Column(name = "`store_id`",nullable = false)
    @NotNull
    private Integer storeId;
    /**
    * 初始给到门店的数量
    */
    @ApiModelProperty(value = "初始给到门店的数量")
    @Column(name = "`init_num`",nullable = false)
    @NotNull
    private Integer initNum;
    /**
    * 物资id
    */
    @ApiModelProperty(value = "物资id")
    @Column(name = "`supplie_id`",nullable = false)
    @NotNull
    private Integer supplieId;
    /**
    * 物资名称 做冗余处理
    */
    @ApiModelProperty(value = "物资名称 做冗余处理")
    @Column(name = "`supplie_name`",nullable = false)
    private String supplieName;
    /**
    * 当前剩余的数量
    */
    @ApiModelProperty(value = "当前剩余的数量")
    @Column(name = "`curr_num`")
    private Integer currNum;
    /**
    * 经度
    */
    @ApiModelProperty(value = "经度")
    @Column(name = "`lng`",nullable = false)
    @NotBlank
    private String lng;
    /**
    * 维度
    */
    @ApiModelProperty(value = "维度")
    @Column(name = "`lat`",nullable = false)
    @NotBlank
    private String lat;
    /**
    * 
    */
    @ApiModelProperty(value = "createBy")
    @Column(name = "`create_by`",nullable = false)
    @NotBlank
    private String createBy;
    /**
    * 
    */
    @ApiModelProperty(value = "updateBy")
    @Column(name = "`update_by`",nullable = false)
    @NotBlank
    private String updateBy;
    /**
    * 
    */
    @ApiModelProperty(value = "createTime")
    @Column(name = "`create_time`",nullable = false)
    @NotNull
    @CreatedDate
    private Timestamp createTime;
    /**
    * 
    */
    @ApiModelProperty(value = "updateTime")
    @Column(name = "`update_time`",nullable = false)
    @NotNull
    @LastModifiedDate
    private Timestamp updateTime;

    public void copy(SuppliesStore source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
